<!--
使用方法：
<loading-view :isVisible=isLoading ></loading-view>
-->
<template>
  <div class="loading" v-show='isVisible'>
    <div class="loading-bg">
      <div class="loading-pic"></div>
      <span>正在加载中...</span>
    </div>
  </div>
</template>

<script>
  export default {
    name: "loading-view",
    props: {
      isVisible: Boolean
    }
  }
</script>

<style scoped>
  /* 进度条样式 */
  .loading {
    position: fixed;
    width: 100%;
    height: 100%;
    background-color: transparent;
    top: 0;
    z-index: 100;
  }

  .loading-bg {
    width: 200px;
    height: 80px;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    margin: 200px auto;
    background: #FFF;
    border-radius: 10px;
  }

  .loading-bg span {
    position: relative;
    left: 80px;
    top: 28px;
    font-size: 16px;
  }

  .loading-pic {
    width: 40px;
    height: 40px;
    position: absolute;
    top: 16px;
    left: 20px;
    margin: auto;
    background: url("../../assets/img/spinner.svg");
    background-size: cover;
    -webkit-animation: loading 1.5s linear infinite;
    animation: loading 1.5s linear infinite;
  }

  @-webkit-keyframes loading {
    0% {
      -webkit-transform: rotate(0deg);
      transform: rotate(0deg)
    }

    50% {
      -webkit-transform: rotate(180deg);
      transform: rotate(180deg)
    }

    100% {
      -webkit-transform: rotate(360deg);
      transform: rotate(360deg)
    }
  }

  @keyframes loading {
    0% {
      -webkit-transform: rotate(0deg);
      transform: rotate(0deg)
    }

    50% {
      -webkit-transform: rotate(180deg);
      transform: rotate(180deg)
    }

    100% {
      -webkit-transform: rotate(360deg);
      transform: rotate(360deg)
    }
  }
</style>
